home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Newton Sample Code 1.2 / Views / SyncScroll-1 / SyncScroll.text < prev    next >
Encoding:
Text File  |  1994-07-07  |  4.2 KB  |  151 lines  |  [TEXT/MPS ]

  1. // Copyright © 1994 Apple Computer, Inc. All rights reserved.
  2.  
  3. // scroll direction constants
  4.  
  5. constant kScrollDown := 1;
  6. constant kScrollUp := -1; 
  7.  
  8. // ---- End Project Data ----
  9.  
  10.  
  11. // ---- File Scroll.t ----
  12.  
  13. // Before Script for "myapp"
  14. // Copyright 1993-1994 Apple Computer, Inc. All rights reserved.
  15.  
  16. myapp :=
  17.    {title: "SyncScroll",
  18.     viewBounds: {left: -4, top: 2, right: 224, bottom: 326},
  19.     viewFormat: 83951953,
  20.     viewSetupFormScript:
  21.       func()
  22.       begin
  23.       constant kMaxWidth := 240;
  24.       constant kMaxHeight := 336;
  25.       local b := GetAppParams();
  26.       
  27.       
  28.       viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop,
  29.               Min(b.appAreaWidth, kMaxWidth),
  30.               Min(b.appAreaHeight, kMaxHeight) );
  31.       
  32.       
  33.       
  34.       end,
  35.     viewScrollDownScript:
  36.       func()
  37.       begin
  38.           scrollArray:DoScroll(kScrollDown) ;
  39.       end,
  40.     viewScrollUpScript:
  41.       func()
  42.       begin
  43.           scrollArray:DoScroll(kScrollUp) ;
  44.       end,
  45.     _proto: protoApp,
  46.     debug: "myapp"
  47.    };
  48.  
  49. scrollarray := /* child of myapp */
  50.    {viewFlags: 33,
  51.     viewFormat: 336,
  52.     viewBounds: {left: 9, top: 73, right: 231, bottom: 247},
  53.     DoScroll:
  54.       func(UpOrDown)
  55.       begin
  56.           // you MUST have in index slot in the parent
  57.           // of the templates you are scrolling. That is
  58.           // the view that recieves the SyncScroll message
  59.           
  60.           // make sure you pass this index
  61.           :SyncScroll(stepchildren, index, UpOrDown) ;
  62.       end,
  63.     index: 0,
  64.     viewclass: 74,
  65.     debug: "scrollarray"
  66.    };
  67. // View scrollarray is declared to myapp
  68.  
  69. _view000 := /* child of scrollarray */
  70.    {viewFlags: 33,
  71.     viewFormat: 12625,
  72.     viewlinespacing: 20,
  73.     viewFont: 18434,
  74.     viewBounds: {left: 0, top: 0, right: 215, bottom: 250},
  75.     viewJustify: 8192,
  76.     text:
  77.       "This is the first item in the array. Now is the time for all good llamas to come to the aid of their party."
  78.     ,
  79.     height: 50,
  80.     viewclass: 81
  81.    };
  82.  
  83. // After Script for "_view000"
  84. thisView := _view000;
  85. thisview.height := thisview.viewBounds.bottom - thisview.viewBounds.top; 
  86. // works for all justifications except vertical full justification!!!!
  87. // for full vertical justification the 'height' slot used by the :SyncScroll method will be different from the view height!!
  88.  
  89.  
  90.  
  91. _view001 := /* child of scrollarray */
  92.    {viewFlags: 33,
  93.     viewFormat: 12625,
  94.     viewlinespacing: 20,
  95.     viewFont: 18434,
  96.     viewBounds: {left: 0, top: 0, right: 215, bottom: 39},
  97.     viewJustify: 8192,
  98.     text:
  99.       "THIS IS THE SECOND ITEM IN THE ARRAY. NOW IS THE TIME FOR ALL GOOD LLAMAS TO COME TO THE AID OF THEIR PARTY."
  100.     ,
  101.     height: 50,
  102.     viewclass: 81
  103.    };
  104.  
  105. // After Script for "_view001"
  106. thisView := _view001;
  107. thisview.height := thisview.viewBounds.bottom - thisview.viewBounds.top; 
  108. // works for all justifications except vertical full justification!!!!
  109. // for full vertical justification the 'height' slot used by the :SyncScroll method will be different from the view height!!
  110.  
  111.  
  112.  
  113. _view002 := /* child of scrollarray */
  114.    {viewFlags: 33,
  115.     viewFormat: 12625,
  116.     viewlinespacing: 20,
  117.     viewFont: 18434,
  118.     viewBounds: {left: 0, top: 0, right: 215, bottom: 103},
  119.     viewJustify: 8192,
  120.     text:
  121.       "This is the last item in the array. Now is the time for all good llamas to come to the aid of their party.Now is the time for all good llamas to come to the aid of their party.Now is the time for all good llamas to come to the aid of their party.Now is the time for all good llamas to come to the aid of their party.Now is the time for all good llamas to come to the aid of their party.Now is the time for all good llamas to come to the aid of their party."
  122.     ,
  123.     height: 50,
  124.     viewclass: 81
  125.    };
  126.  
  127. // After Script for "_view002"
  128. thisView := _view002;
  129. thisview.height := thisview.viewBounds.bottom - thisview.viewBounds.top; 
  130. // works for all justifications except vertical full justification!!!!
  131. // for full vertical justification the 'height' slot used by the :SyncScroll method will be different from the view height!!
  132.  
  133.  
  134.  
  135.  
  136.  
  137. _view003 := /* child of myapp */
  138.    {text: "Using an array of view templates:",
  139.     viewBounds: {left: 8, top: 48, right: 208, bottom: 64},
  140.     _proto: protoStaticText
  141.    };
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149. // ---- Beginning of section for non used Layout files ----
  150.  
  151. // End of output